package com.network.service.impl;

import com.network.mapper.UserMapper;
import com.network.pojo.User;
import com.network.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.time.LocalDateTime;

@Service
public class UserServiceImpl implements UserService {
    @Autowired
    private UserMapper userMapper;

    @Override
    public void add(User user) {
        LocalDateTime now = LocalDateTime.now();
        user.setCreateTime(now);
        userMapper.insert(user);
    }

    @Override
    public User login(User user) {
        User u = userMapper.getByUsernameAndPassword(user);
        return u;
    }
}
